/*
 * RTP muxer definitions
 * Copyright (c) 2002 Fabrice Bellard
 *
 * This file is part of FFmpeg.
 *
 * FFmpeg is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * FFmpeg is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with FFmpeg; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */
#ifndef AVFORMAT_RTPENC_JTT1078_H
#define AVFORMAT_RTPENC_JTT1078_H

#include "avformat.h"
#include "rtp.h"

struct RTPJTTMuxContext {
    const AVClass *av_class;
    AVFormatContext *ic;
    AVStream *st;
    int payload_type[2];
    uint32_t ssrc;
    const char *cname;
    int seq;
    int logic_channel;
    const char *sim;
    uint32_t timestamp;
    uint32_t base_timestamp;
    uint32_t cur_timestamp;
    int max_payload_size[2];
    int num_frames[2];

    /* rtcp sender statistics */
    int64_t last_rtcp_ntp_time;
    int64_t first_rtcp_ntp_time;
    unsigned int packet_count;
    unsigned int octet_count;
    unsigned int last_octet_count;
    int first_packet;
    /* buffer for output */
    uint8_t *buf[2];
    uint8_t *buf_ptr[2];

    int max_frames_per_packet[2];

    /**
     * Number of bytes used for H.264 NAL length, if the MP4 syntax is used
     * (1, 2 or 4)
     */
    int nal_length_size;
    int buffered_nals;

    int flags;

    unsigned int frame_count;
};

typedef struct{
    uint64_t    init_time;
    uint64_t    last_frame_time;
    uint64_t    cur_frame_time;
    uint64_t    last_I_frame_time;
    uint64_t    cur_I_frame_time;
    uint64_t    audio_frame_time;
    uint64_t    audio_init_time;
}RTPJTTTimeRecord;

typedef enum{
    VEDIO = 0,
    AUDIO,
}eDataType;

typedef struct RTPJTTMuxContext RTPJTTMuxContext;

void ff_rtp_send_data_jtt1078(AVFormatContext *s1, const uint8_t *buf1, int len, int m, enum AVPictureType pict_type, uint8_t split, eDataType etype);



#endif /* AVFORMAT_RTPENC_JTT1078_H */
